import { extendApi } from '@inbiz/utils';
import { MutableRefObject } from 'react';
import type { IProps } from './index';

export default extendApi((_events: MutableRefObject<IProps['callBackEvents']>, params) => {
  const { setState, list, $isLoadData } = params;
  return {
    getData: () => {
      return list || [];
    },
    loadData: (data = []) => {
      setState(data);
      $isLoadData(true);
    },
  };
});
